package de.unimannheim.ki.servlets;

import com.google.gson.Gson;

public class JsonError {
	private String errorname;
	private int errorcode;
	public JsonError(String errorname, int errorcode) {
		super();
		this.errorname = errorname;
		this.errorcode = errorcode;
	}
	
	public static JsonError generateNotLoggedIn(){
		return new JsonError("You have to be logged in to use this service", 1);
	}
	
	public static JsonError generateNoSongsAvailable(){
		return new JsonError("Sorry! We have suggestions for you", 2);
	}
	
	public static JsonError generateParameterMissing(){
		return new JsonError("Sorry!but there are parameters missing", 2);
	}
	
	public static JsonError generateOffsettoHigh(){
		return new JsonError("Sorry! But the given start value and offset are to high", 3);
	}
	public static String toJsonString(JsonError e){
		Gson g = new Gson();
		return g.toJson(e);
	}
}

